#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
//void* my_memset(void* ptr,int value,size_t num) {
//	void* ret = ptr;
//	while (num--)
//	{
//		*(unsigned char*)ptr = (unsigned char)value;
//		ptr = (char*)ptr + 1;
//	}
//	return ret;
//}
//int main()
//{
//	char source[] = "abcedfg";
//	char dest[30] = { 0 };
//	printf("%s\n", memcpy(dest, source, 6));
//	printf("%s\n", dest);
//}




int my_memcmp(void* ptr1,void* ptr2,size_t num) {
	while (num--)
	{
		if (*(char*)ptr1 != *(char*)ptr2)
			return strncmp((char*)ptr1, (char*)ptr2, 1);
		ptr1 = (char*)ptr1 + 1;
		ptr2 = (char*)ptr2 + 1;
	}
	return 0;
}
int main() 
{
	char arr[] = "abcdef";
	char arr2[] = "abddef";
	printf("%d\n", my_memcmp(arr, arr2, 5));
	printf("%d\n", my_memcmp(arr2, arr, 5));
	printf("%d\n", my_memcmp(arr2, arr, 2));
}